var express = require('express');
var router = express.Router();
const {API_PREFIX}=require('../config/api')
const controlCommonUpload=require('../Controller/common/upload')
const controlCommonUser=require('../Controller/common/user')
const controlCommonCaptcha=require('../Controller/common/captcha')
const {upload}=require('../Middlewear/upload')
const {authenticateToken}=require('../Middlewear/authenticateToken')
router.post(API_PREFIX+'/common/upload', authenticateToken, upload.single('file'),controlCommonUpload.upload)
router.post(API_PREFIX+'/common/login', controlCommonUser.login)
router.post(API_PREFIX+'/common/register', controlCommonUser.register)
router.get(API_PREFIX+'/common/captcha', controlCommonCaptcha.captcha)
module.exports = router;
/**
 * @swagger
 * /common/upload:
 *   post:
 *     summary: 图片上传
 *     description: 公共图片上传
 *     tags:
 *       - 公共区域
 *     parameters:
 *       - in: FormData
 *         name: file
 *         schema:
 *           type: file
 *         required: true
 *         description: The ID of the user to retrieve.
 *     responses:
 *       200:
 *         description: A list of users.
 */
/**
 * @swagger
 * /common/login:
 *   post:
 *     summary: 登录
 *     description: Authenticates a user and returns an authentication token.
 *     tags:
 *       - 公共区域
 *     requestBody:
 *       required: true
 *       content:
 *         application/json:
 *           schema:
 *             type: object
 *             properties:
 *               userName:
 *                 type: string
 *                 description: 用户的用户名，必须是一个字符串类型。
 *               password:
 *                 type: string
 *                 description: 密码
 *               captcha:
 *                 type: string
 *                 description: 验证码
 *             required:
 *             - userName
 *             - password
 *             - captcha
 *     responses:
 *       200:
 *         description: Successful login.
 *         content:
 *           application/json:
 *             schema:
 *               type: object
 *               properties:
 *                 token:
 *                   type: string
 *                   description: Authentication token.
 *       400:
 *         description: Invalid username or password.
 */
/**
 * @swagger
 * /common/register:
 *   post:
 *     summary: 注册
 *     description: Authenticates a user and returns an authentication token.
 *     tags:
 *       - 公共区域
 *     requestBody:
 *       required: true
 *       content:
 *         application/json:
 *           schema:
 *             type: object
 *             properties:
 *               username:
 *                 type: string
 *               password:
 *                 type: string
 *             required:
 *             - username
 *             - password
 *     responses:
 *       200:
 *         description: Successful login.
 *         content:
 *           application/json:
 *             schema:
 *               type: object
 *               properties:
 *                 token:
 *                   type: string
 *                   description: Authentication token.
 *       400:
 *         description: Invalid username or password.
 */
/**
 * @swagger
 * /common/captcha:
 *   get:
 *     summary: 验证码
 *     description: Get a list of users.
 *     tags:
 *       - 公共区域
 *     responses:
 *       200:
 *         description: A list of users.
 */